export default {
    data () {
        return {

            loginData: {},
            loginRules: {
                user: [
                    { required: true, message: '请填写用户名', trigger: 'blur' }
                ],
                password: [
                    { required: true, message: '请填写密码', trigger: 'blur' },
                    { type: 'string', min: 6, message: '密码长度不能小于6位', trigger: 'blur' }
                ]
            }
        }
    },
    mounted() {
    },
    created() {
    },
    watch: {
        // loginData (newValue, oldVlue) {
        //     console.log(newValue, oldVlue);
        // }
    },
    methods: {

        handleSubmit (name) {

            this.$refs[name].validate((valid) => {

                if (valid) {
                    this.search()
                }
            })
        },
        
        search () {
            console.log(this.loginData);
            // this.$axios.defaults.headers['Content-Type']     = 'application/x-www-form-urlencoded;charset=utf-8';
            let _uri = 'http://localhost/index.php'
            this.$axios.post(_uri, this.loginData).then(res => {
                console.log(res)
                this.$Message.success('提交成功!')
            });
        }
    }
}